//index.js
//获取应用实例
const app = getApp()
Page({
  data: {
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 500,
    logo:true,
    city: "",
    navindex: 0,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    movies: [
      { url: 'http://nxshuiguo.135k.com/img/banner1.jpg' },
      { url: 'http://nxshuiguo.135k.com/img/banner2.jpg' },
    ],
    nav:[
      { icon: 'http://nxshuiguo.135k.com/img/nav_03.png', name: '保洁服务', xq: '房屋日常保洁  房屋日常保洁  房屋日常保洁', url:'../bjlist/bjlist'},
      { icon: 'http://nxshuiguo.135k.com/img/nav_06.png', name: '维修服务', xq: '家电维修  手机维修', url: '../wxlist/wxlist' },
      { icon: 'http://nxshuiguo.135k.com/img/nav_05.png', name: '搬家服务', xq: '专业搬家团队，提供优质服务', url: '../bjfwlist/bjfwlist' },
      { icon: 'http://nxshuiguo.135k.com/img/nav_04.png', name: '保姆月嫂', xq: '贴心服务，经验丰富的团队', url: '../bmlist/bmlist' },
      { icon: 'http://nxshuiguo.135k.com/img/nav_08.png', name: '管道维修', xq: '专业工具，资深技师服务', url: '../gdwxlist/gdwxlist' },
    ],
    listTab:[
      { pic: '/images/index_01.png', name: '首页', url:'../index/index'},
      { pic: '/images/index_04.png', name: '分类', url: '../list/list' },
      { pic: '/images/index_06.png', name: '订单', url: '../order/order' },
      { pic: '/images/index_08.png', name: '我的', url: '../my/my' },
      
    ]
  },
  start_search: function () {
    app.navTo('../search/search')
  },
  //消息
  start_message:function(){
    app.navTo('../message/message')
  },
  //事件处理函数
  navlist: function (e) {
    var url = e.currentTarget.dataset.url
    app.navTo(url)
  },
  // 选择地址
  chose_city: function () {
    wx.navigateTo({
      url: '../address/address',
    })
  },
  //底部
  // tabBar: function (e) {
  //   // var url = e.currentTarget.dataset.url;
  //   var index = e.currentTarget.dataset.index;

  //   var name = this.data.listTab;
  //   // return false;
  //   // app.radTo(url)
  //   this.setData({
  //     navindex: index
  //   })
  // },
  index: function () {
    app.radTo('../index/index')
  },
  list: function () {
    app.radTo('../lists/lists')
  },
  order: function () {
    app.radTo('../order/order')
  },
  my: function () {
    app.radTo('../my/my')
  },
  //登录
  sendRequest: function (res) {
    var that = this;
    wx.request({
      url:  ' ',
      data: {
 
      },
      method: ' ',
      success: function (res) {
 
      }
    })
  },
  onLoad: function () {    
    getApp().editTabBar();     
  },
  /**
  * 生命周期函数--监听页面显示
  */
  onShow: function () {
    let that = this
    if (!app.data.address.name) {
      wx.getLocation({
        type: 'gcj02',
        success: function (res) {
          console.log(res);
        },
      })
    }
    that.setData({
      city: app.data.address.name || "西安"
    })

  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
